<%@ Page Language="C#" MasterPageFile="~/MyMasterPage.master" AutoEventWireup="true" CodeFile="Comments.aspx.cs" Inherits="Comments" Title="Untitled Page" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<%@ Register Src="Controls/Captcha.ascx" TagName="Captcha" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <div class="total" style="text-align:justify">
    		<div class="right_side" style="text-align:justify; width: 317px; height: 435px;">
    		    
                    <asp:ScriptManager id="ScriptManager1" runat="server">
                    </asp:ScriptManager>
                    <asp:Panel id="Panel3" runat="server" Width="304px" Height="68px" Visible="False">
                        <h2>Thanks your for your comment .</h2>
                        <h2>Your post will publish after modaration of post author</h2>
                     </asp:Panel>
                    <asp:Panel ID="Panel1" runat="server" Height="385px" Width="307px">
                    <h2>Leave your comment:</h2>
                        
                        <asp:TextBox ID="txtComment" runat="server" Height="157px" TextMode="MultiLine" Width="284px"></asp:TextBox><br />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
                            ErrorMessage="Write Your Comment Please" ControlToValidate="txtComment"></asp:RequiredFieldValidator>
                        <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="server" TargetControlID="RequiredFieldValidator3">
                        </cc1:ValidatorCalloutExtender>
                        
                        
                            <asp:Panel ID="Panel2" runat="server" Height="12px" Width="292px">
                                <h4 >   
                                 <span style="font-size: 10pt">Comment moderation has been enabled. All comments must be approved by the blog author.</span><span style="font-size: 10pt"> </span>
                                </h4>
                             </asp:Panel>  
                        <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="RequiredFieldValidator1">
                        </cc1:ValidatorCalloutExtender>
                        <br />  
                        <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" TargetControlID="RequiredFieldValidator2">
                        </cc1:ValidatorCalloutExtender>
                        <br />  <br />
                         
                      
                        <table>
                            <tr>
                                <td style="width: 288px">NickName : <br/>
                                  <asp:TextBox ID="txtNickName" runat="server" Width="256px" MaxLength="128"></asp:TextBox><br />
                                  <asp:RequiredFieldValidator ControlToValidate="txtNickName" ID="RequiredFieldValidator1" runat="server" ErrorMessage="Write Your Name Please"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 288px">
                                    E-Mail : <br/>
                                    <asp:TextBox ID="txtEmail" runat="server" Width="256px" MaxLength="256"></asp:TextBox>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Invalid E-mail" ValidationExpression="^((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$" ControlToValidate="txtEmail"></asp:RegularExpressionValidator>&nbsp;
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtEmail"
                                        ErrorMessage="Write Your E-mail Please"></asp:RequiredFieldValidator></td>
                            </tr>
                            <tr>
                                <td style="width: 288px; height: 187px;">Word Varification : <br/>
                                <uc1:Captcha ID="Captcha1"
                                             Message="Please enter text shown below:"
                                             runat="server"
                                             OnSuccess="OnSuccess" OnFailure="OnFailure" />
                                </td>
                                
                            </tr>
                        </table>
                            </asp:Panel>
                    
					

				
							    
			    </div>
			<div class="left_side" style="text-align:justify; width: 319px;">
			
				<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
                        SelectCommand="SELECT CommentID AS Expr1, (SELECT PostTitle FROM Blog WHERE (BlogID = @BlogID)) AS BlogTitle, CommentBy, CommentDesc, IPAddress, BlogID, IsPublished, CommentDate FROM BlogComment WHERE (BlogID = @BlogID) AND (IsPublished = 'True') ORDER BY CommentDate">
                        <SelectParameters>
                            <asp:QueryStringParameter DefaultValue="2" Name="BlogID" QueryStringField="BlogID"
                                Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                    
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
                    SelectCommand="SELECT PostTitle, BlogID FROM Blog WHERE (BlogID = @BlogID)">
                    <SelectParameters>
                        <asp:QueryStringParameter DefaultValue="2" Name="BlogID" QueryStringField="BlogID" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>" ></asp:SqlDataSource>
                    
                <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
                  <ItemTemplate>
                     <h2><asp:Label ID="itemContentLabel" runat="server" Text='<%# Eval("PostTitle") %>'></asp:Label></h2>
                  </ItemTemplate>
                </asp:Repeater>
                <br />
                <asp:DataList ID="DataList1" runat="server" DataKeyField="Expr1" DataSourceID="SqlDataSource1">
                    <ItemTemplate>
                     <h3><asp:Label ID="CommentByLabel" runat="server" Text='<%# Eval("CommentBy") %>'></asp:Label> Wrote</h3>
	            	       <div class="padding" style="text-align: justify">
		                <asp:Label ID="CommentDescLabel" runat="server" Text='<%# Eval("CommentDesc") %>'> </asp:Label><br />
                    </div>
                    <p class="date"> 
                            Comment Posted at <asp:Label ID="CommentDateLabel" runat="server" Text='<%# Eval("CommentDate") %>'>
                        </asp:Label>  
                       </p>
                    </ItemTemplate>
                </asp:DataList><br />
         </div> 
    </div>                    
</asp:Content>

